# install anaconda
# anaconda installer archive list https://repo.anaconda.com/archive/
wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-2020.07-Linux-x86_64.sh
bash Anaconda3-2020.07-Linux-x86_64.sh -b -p $HOME/anaconda3
source ~/anaconda3/bin/activate
source ~/.bashrc
echo "anaconda3 install successfully"
rm -rf Anaconda3-2020.07-Linux-x86_64.sh


#!/usr/bin/env bash

# use aliyun yum source
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum clean


# update yum
yum update -y
yum install dos2unix -y
yum install wget -y


# install git
sudo yum install git-core -y
git config --global user.name weizhiqimail
git config --global user.email weizhiqimail@foxmail.com
echo "git install successfully"


# install java
sudo yum update -y
sudo yum install java-11-openjdk-devel  -y
echo "install java successfully"


# install jenkins
sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins.io/redhat-stable/jenkins.repo
sudo rpm --import http://pkg.jenkins.io/redhat-stable/jenkins.io.key
sudo yum install jenkins -y
sudo yum install maven -y
echo "install jenkins successfully"


# install mongodb
echo "[mongodb-org-4.4]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/7/mongodb-org/4.4/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-4.4.asc" > /etc/yum.repos.d/mongodb-org-4.4.repo
sudo yum install -y mongodb-org -y
sudo yum install -y mongodb-org-4.4.1 mongodb-org-server-4.4.1 mongodb-org-shell-4.4.1 mongodb-org-mongos-4.4.1 mongodb-org-tools-4.4.1
sudo service mongod start
echo "mongodb install successfully"


# install nginx
echo "
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/mainline/centos/7/x86_64/
gpgcheck=0
enabled=1
" > /etc/yum.repos.d/nginx.repo
sudo yum-config-manager --enable nginx-mainline
sudo yum install nginx -y
echo "install nginx successfully"
sudo systemctl enable nginx
sudo systemctl start nginx
echo "start nginx successfully"


# install nvm
wget https://gitee.com/Carlli/linux-auto-tasks/raw/master/libs/nvm/nvm-install-v0.37.0.sh
dos2unix nvm-install-v0.37.0.sh
bash nvm-install-v0.37.0.sh
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion
echo "nvm install successfully"
rm -rf nvm-install-v0.37.0.sh


# update nvm install source, use taobao mirror
export NVM_NODEJS_ORG_MIRROR=http://npm.taobao.org/mirrors/node
source ~/.bashrc
echo "nvm update org mirror successfully"

# install node and npm libs
nvm install 14.9.0
nvm use 14.9.0
npm install -g cnpm --registry=https://registry.npm.taobao.org
cnpm install http-server pm2 nodemon yarn -g
echo "node and npm install successfully"


# install redis
sudo yum install epel-release yum-utils -y
sudo yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm -y
sudo yum-config-manager --enable remi -y
sudo yum install redis -y
sudo systemctl start redis
sudo systemctl enable redis
echo "redis install successfully"


source ~/.bashrc

